<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script>
        function page(pageNo) {
            window.location.href="module.one?pageNo="+pageNo;
        }
    </script>
</head>
<body>
    <form th:action="@{/module.one}" method="get">
        <input type="text" name="likeName"/>
        <input type="submit" value="查询">
    </form>
    <table>
        <tr>
            <td>id</td>
            <td>name</td>
            <td>sex</td>
            <td>age</td>
            <td><a th:href="@{/module.one(flag='addPage')}">新增</a></td>
        </tr>
        <!-- session.selectAll 就是在Servlet组件中保存在session作用域内的集合 -->
        <tr th:if="${#lists.isEmpty(session.selectAll)}">
            <td colspan="5">无客户名单！</td>
        </tr>
        <tr th:unless="${#lists.isEmpty(session.selectAll)}" th:each="tang : ${session.selectAll}">
            <td><a th:text="${tang.id}"  th:href="@{/module.one(id=${tang.id},flag='selectOne')}">id</a></td>
            <td th:text="${tang.name}">name</td>
            <td th:text="${tang.sex}">sex</td>
            <td th:text="${tang.age}">age</td>
            <td>
                <a th:href="@{/module.one(id=${tang.id},flag='delete')}">删除</a>
            </td>
        </tr>
    </table>
    <input type="button" value="首 页" th:onclick="|page(1)|" th:disabled="${session.pageNo==1}"/>
    <input type="button" value="上一页" th:onclick="|page(${session.pageNo - 1})|" th:disabled="${session.pageNo==1}"/>
    <input type="button" value="下一页" th:onclick="|page(${session.pageNo + 1})|" th:disabled="${session.pageNo==session.sum}"/>
    <input type="button" value="尾 页" th:onclick="|page(${session.sum})|" th:disabled="${session.pageNo==session.sum}"/>
</body>
</html>
